/**
 * 
 */
package tcss543.cpap.common;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import junit.framework.TestCase;

import org.junit.Test;

/**
 * @author ashish
 * 
 */
public class TestQualityCalculator extends TestCase {

	/*
	 * (non-Javadoc)
	 * 
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see junit.framework.TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
	}

	@Test
	public void test1() {

		final Map<Short, Set<Short>> papers = new HashMap<Short, Set<Short>>();
		final short ONE = 1;
		final short TWO = 2;
		final short THREE = 3;
		
		papers.put(ONE, new TreeSet<Short>());
		papers.get(ONE).add(ONE);

		final Map<Short, Map<Short, ReviewerRank>> reviewers = new HashMap<Short, Map<Short, ReviewerRank>>();
		reviewers.put(ONE, new HashMap<Short, ReviewerRank>());
		reviewers.get(ONE).put(ONE, ReviewerRank.YES);

		reviewers.put(TWO, new HashMap<Short, ReviewerRank>());
		reviewers.get(TWO).put(ONE, ReviewerRank.YES);
		
		reviewers.put(THREE, new HashMap<Short, ReviewerRank>());
		reviewers.get(THREE).put(ONE, ReviewerRank.YES);
		
		
		final Map<Short, Set<Short>> solution = new HashMap<Short, Set<Short>>();
		solution.put(ONE, new TreeSet<Short>());		
		solution.put(TWO, new TreeSet<Short>());
		solution.put(THREE, new TreeSet<Short>());
		
		solution.get(ONE).add(ONE);
		solution.get(TWO).add(ONE);
		solution.get(THREE).add(ONE);
		
		double quality = Utilities
				.calculateQuality(solution, papers, reviewers,false).doubleValue();
		assertEquals(-24, quality, .1);
	}
}
